package com.springboot.demo.linked;

/**
 * 单向链接测试类
 *
 * @author supu
 * @date 2019-06-19 10:48
 **/
public class SimpleLinkedDemo {
    public static void main(String[] args) {
        LinkedList linkedList = new LinkedList();
        Node node5 = new Node();
        node5.setData("five");
        Node node4 = new Node("four");
        Node node3 = new Node("three");
        Node node2 = new Node("two");
        Node node1 = new Node("one");
        linkedList.addNode(node1);
        linkedList.addNode(node2);
        linkedList.addNode(node3);
        linkedList.addNode(node4);
        linkedList.printNode();

        linkedList.removeNode(node2);
        linkedList.printNode();

        linkedList.addNode(node5);
        linkedList.printNode();

        linkedList.updateNode(node4, "newFour");
        linkedList.printNode();
    }
}
